package com.iwhalecloud.citybrain.flow.platform.manager.application.common.command;

import java.io.Serializable;

import org.flowable.engine.common.impl.interceptor.Command;
import org.flowable.engine.common.impl.interceptor.CommandContext;
import org.flowable.engine.impl.persistence.entity.ResourceEntity;
import org.flowable.engine.impl.util.CommandContextUtil;

/**
 * @author lilh
 * @date 2019-01-30 16:52
 */
public class ResourcePersistCmd implements Command<Void>, Serializable {
    private static final long serialVersionUID = -8142342879173599475L;

    private ResourceEntity resourceEntity;

    public ResourcePersistCmd(ResourceEntity resourceEntity) {
        this.resourceEntity = resourceEntity;
    }

    @Override
    public Void execute(CommandContext commandContext) {
        CommandContextUtil.getResourceEntityManager(commandContext).insert(resourceEntity);
        return null;
    }
}
